package xyz.jason.mybatisgenerator.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import xyz.jason.mybatisgenerator.util.FileUtils;

import javax.annotation.PostConstruct;
import java.util.stream.Stream;

/**
 * @ProjectName: mybatis-generator
 * @Package: xyz.jason.mybatisgenerator.config
 * @ClassName: PathConfig
 * @Author: Jason · L
 * @Description: 配置
 * @Date: 2021/4/7 9:42
 * @Version: 1.0
 */
@Data
@ConfigurationProperties("default")
public class PathConfig {

    private String path;
    private String resources ;
    private String java ;
    private String dataUrl ;
    private String zipPath ;
    private String downLoadUrl;


    /*
      初始化创建目录
     */
    @PostConstruct
    public void init(){
        Stream.of(path+resources,path+java,zipPath)
                .forEach(FileUtils::fileMkDirs);
    }
}
